<template>
  <div>
    <h4>还款计划</h4>
    <el-table :data="lendReturns" stripe style="width: 100%" border>
      <el-table-column type="index" label="序号" width="70" align="center" />
      <el-table-column prop="currentPeriod" label="当前的期数" />
      <el-table-column prop="principal" label="本金" />
      <el-table-column prop="interest" label="利息" />
      <el-table-column prop="total" label="本息" />
      <el-table-column prop="returnDate" label="还款日期" width="150" />
      <el-table-column prop="realReturnTime" label="实际还款时间" />
      <el-table-column label="是否逾期">
        <template slot-scope="scope">
          <span v-if="scope.row.overdue">
            是（逾期金额：{{ scope.row.overdueTotal }}元）
          </span>
          <span v-else>否</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" width="80">
        <template slot-scope="scope">
          {{ scope.row.status === 0 ? '未还款' : '已还款' }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import lendApi from '@/api/lend'
export default {
  data() {
    return {
      lendReturns: [],
    }
  },
  created() {
    lendApi.getLendReturns(this.$route.params.id).then((r) => {
      this.lendReturns = r.data.items
    })
  },
}
</script>
